package com.mimiwang.common.entity.user;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.mimiwang.common.group.Insert;
import com.mimiwang.common.group.Update;
import lombok.*;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 
 * 
 * @author hustart
 * @email hustart1@126.com
 * @date 2022-09-30 22:24:17
 */
@Data
@TableName("user_info")
@Validated
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class UserInfoEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	private static final int DEFAULT_STATUS=1;
	private static final String DEFAULT_NICK_NAME="MimiWang";
	private static final int DEFAULT_DELETE=0;

	/**
	 * id
	 */
	@TableId
//	@JSONField( serialize = false)
	private Long userId;
	/**
	 * 账号
	 */
	@NotBlank
	// 排除特殊字符
	@Pattern(regexp = " [、_ =\\ \\\\ [\\ ] ; ' ，. / ~ ! @ # $ % ^ & * ( ) + | ? > < “ :{}]",message = "用户名不能包含特殊字符")
	private String userName;
	/**
	 * 密码
	 */
	@NotBlank
	@JSONField( serialize = false)
	private String password;
	/**
	 * 名称
	 */
	@NotNull
	private String userNick;
	/**
	 * 邮箱
	 */
	@Email(message = "请输入正确的邮箱",groups = {Insert.class, Update.class})
	private String email;
	/**
	 * 手机号
	 */
	private String mobile;
	/**
	 * 状态： 0 - 封禁 / 1 -正常
	 */
	private Integer status;
	/**
	 * 创建时间
	 */

	@JSONField(name="createTime")
	@TableField(fill = FieldFill.INSERT)
	private Date gmtCreate;
	/**
	 * 最新修改时间
	 */
	@JSONField(name="lastModify")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date gmtModified;

	/**
	 * 逻辑删除: 0 未删除 / 1 删除
	 */
	@TableLogic
	@JSONField( serialize = false)
	private Integer isDelete = 0;
	/**
	 *
	 * 头像
	 * */
	private String avatar;

}
